package com.yao.sdk.util;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

import java.io.File;
import java.io.FileInputStream;
import java.util.List;

/**
 * 常见工具类
 */
public class Utils {

    public static boolean isEmpty(String str) {
        if (str != null && str.length() > 0) {
            return false;
        }
        return true;
    }

    public static boolean isEmpty(String[] array) {
        if (array != null && array.length > 0) {
            return false;
        }
        return true;
    }



    public static boolean isEmpty(List list) {
        if (list != null && list.size() > 0) {
            return false;
        }
        return true;
    }

    public static Bitmap getDiskBitmap(String pathString) {
        Bitmap bitmap = null;
        try
        {
            File file = new File(pathString);
            if(file.exists())
            {
                FileInputStream fis = new FileInputStream(pathString);
                return BitmapFactory.decodeStream(fis);

               // bitmap = BitmapFactory.decodeFile(pathString);
            }
        } catch (Exception e)
        {
            // TODO: handle exception
        }


        return bitmap;
    }

}
